<template>
	<u-popup v-model="popupShow" mode="bottom" width="750rpx" height="1080rpx" border-radius="16" :mask-close-able="false">
		<view class="popup_box">
			<view class="header">
				<view class="left">
					切换门店
				</view>
				<view class="right-Close" @click="sure">
					<u-icon name="close" color="#666666" size="34" ></u-icon>
				</view>
			</view>
			<scroll-view scroll-y="true" style="height: 950rpx" @scrolltolower="scrolltolower">
				<view class="comlum_box">
					<view v-for="(item,index) in FieldList" :key="index" class="item_box" @click="changeActiveIndex(item,index)">
						<image :src="item.category_image" mode="aspectFill" class="tag-img"></image>
						<view class="title">
							{{item.shop_name}}
						</view>
						<view class="flex">
						</view>
						<view class="distance">
							<image :src="activeIndex == index ?$IMG_URL('/static/member/agreement2.png'):$IMG_URL('/static/member/agreement1.png')" mode="" class="radio"></image>
						</view>
					</view>
					<u-loadmore :status="status" />
				</view>
				
			</scroll-view>
		</view>
	</u-popup>
</template>

<script>
	import{
		shopList
	} from '@/api/coach.js'
	export default{
		props: {
			popupShow: {
				type: Boolean,
				default: false,
				required: true
			},
			activeIndex:{
				type:Number,
				default: null,
				required: true
			}
		},
		data(){
			return{
				FieldList:[],
				status: 'loadmore', //当前状态
				query:{
					page:1
				}
			}
		},
		created() {
			this.getshopList()
		},
		methods:{
			
			scrolltolower(){
				this.query.page++
				this.getshopList()
			},
			getshopList(){
				shopList(this.query).then(({data:res})=>{
					console.log('res', res);
					if (res.code == 1) {
						this.FieldList = res.data
					}
				})
			},
			sure(){
				this.$emit('sure')
			},
			changeActiveIndex(item, index){
				this.$emit('changeActiveIndex', item, index)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.popup_box{
		width: 750rpx;
		height: 1080rpx;
		padding: 36rpx 40rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		.header{
			width: 100%;
			display: flex;
			flex-direction: row;
			align-items: center;
			.left{
				font-size: 36rpx;
				font-family: PingFang SC, PingFang SC-Bold;
				font-weight: 700;
				text-align: left;
				color: #333333;
				flex: 1;
			}
			.right-Close{
				width: 52rpx;
				height: 52rpx;
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
		
		.comlum_box{
			display: flex;
			flex-direction: column;
			align-items: center;
			width: 100%;
			padding-top: 48rpx;
			.item_box{
				display: flex;
				flex-direction: row;
				align-items: center;
				width: 100%	;
				height: 88rpx;
				background: #f6f6f6;
				border-radius: 16rpx;
				margin-bottom: 24rpx;
				padding: 0 32rpx;
				.tag-img{
					width: 106rpx;
					height: 32rpx;
					margin-right: 12rpx;
				}
				
				.title{
					font-size: 28rpx;
					font-family: PingFang SC, PingFang SC-Medium;
					font-weight: 500;
					text-align: left;
					color: #333333;
					margin-right: 10rpx;
				}
				.tag_box{
					width: 52rpx;
					height: 30rpx;
					background: #f6f6f6;
					border-radius: 4rpx;
					font-size: 20rpx;
					font-family: PingFang SC, PingFang SC-Medium;
					font-weight: 500;
					text-align: left;
					color: #666666;
					display: flex;
					align-items: center;
					justify-content: center;
				}
				
				.flex{
					flex: 1;
				}
				
				.distance{
					display: flex;
					flex-direction: row;
					align-items: center;
					.size_s{
						font-size: 24rpx;
						font-family: PingFang SC, PingFang SC-Medium;
						font-weight: 500;
						color: #999999;
						margin-right: 16rpx;
					}
					.radio{
						width: 36rpx;
						height: 36rpx;
						border: 2rpx solid #73F0EA;
						border-radius: 50%;
					}
				}
			}
		}
		.btn{
			width: 710rpx;
			height: 88rpx;
			background: #73F0EA;
			border-radius: 16rpx;
			font-size: 34rpx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: 700;
			text-align: center;
			color: #ffffff;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}
</style>